//
//  WGCityTableViewController.m
//  QuickCure1
//
//  Created by Apple on 16/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "WGCityTableViewController.h"
#import "WGDetailCitiesTableViewController.h"

static NSString *cellID = @"cell";

@interface WGCityTableViewController ()

@end

@implementation WGCityTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"省份选择";
    
    //注册cell
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
}

//获取选中的行
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    
    return self.cityList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    
    //取出模型
    WGCityModel *model = self.cityList[indexPath.row];
    cell.textLabel.text = model.name;
    [cell.textLabel setTextColor:[UIColor jq_randomColor]];
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    WGDetailCitiesTableViewController *vc= [[WGDetailCitiesTableViewController alloc]init];
    //取出模型
    WGCityModel *model = self.cityList[indexPath.row];
    vc.cities = model.cities;
    
    [self.navigationController pushViewController:vc animated:YES];
    
}


@end
